from django.shortcuts import render,redirect,reverse
from articles.models import Friendlink
# Create your views here.

def friendlink(request):
    links = Friendlink.objects.all()
    return render(request, 'flink.html',locals())

# 基本设置
def do_setting(request):
    return render(request, 'setting.html')
def add_flink(request):
    if request.method == "POST":
        title = request.POST.get("title")
        link = request.POST.get("link")
        obj = Friendlink(title=title,link=link)
        obj.save()
        return redirect(reverse("others:flink"))
    return render(request, 'add-flink.html')